Optimal. Leaf size=101 \[ \frac{\left (4 a^2+3 b^2\right ) \sin (c+d x) \cos (c+d x)}{8 d}+\frac{1}{8} x \left (4 a^2+3 b^2\right )-\frac{2 a b \sin ^3(c+d x)}{3 d}+\frac{2 a b \sin (c+d x)}{d}+\frac{b^2 \sin (c+d x) \cos ^3(c+d x)}{4 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0920934, antiderivative size = 101, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.238, Rules used = {2789, 2633, 3014, 2635, 8} \[ \frac{\left (4 a^2+3 b^2\right ) \sin (c+d x) \cos (c+d x)}{8 d}+\frac{1}{8} x \left (4 a^2+3 b^2\right )-\frac{2 a b \sin ^3(c+d x)}{3 d}+\frac{2 a b \sin (c+d x)}{d}+\frac{b^2 \sin (c+d x) \cos ^3(c+d x)}{4 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2789
Rule 2633
Rule 3014
Rule 2635
Rule 8
Rubi steps
\begin{align*} \int \cos ^2(c+d x) (a+b \cos (c+d x))^2 \, dx &=(2 a b) \int \cos ^3(c+d x) \, dx+\int \cos ^2(c+d x) \left (a^2+b^2 \cos ^2(c+d x)\right ) \, dx\\ &=\frac{b^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}+\frac{1}{4} \left (4 a^2+3 b^2\right ) \int \cos ^2(c+d x) \, dx-\frac{(2 a b) \operatorname{Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{d}\\ &=\frac{2 a b \sin (c+d x)}{d}+\frac{\left (4 a^2+3 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac{b^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac{2 a b \sin ^3(c+d x)}{3 d}+\frac{1}{8} \left (4 a^2+3 b^2\right ) \int 1 \, dx\\ &=\frac{1}{8} \left (4 a^2+3 b^2\right ) x+\frac{2 a b \sin (c+d x)}{d}+\frac{\left (4 a^2+3 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac{b^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac{2 a b \sin ^3(c+d x)}{3 d}\\ \end{align*}
Mathematica [A] time = 0.156146, size = 86, normalized size = 0.85 \[ \frac{24 \left (a^2+b^2\right ) \sin (2 (c+d x))+48 a^2 c+48 a^2 d x-64 a b \sin ^3(c+d x)+192 a b \sin (c+d x)+3 b^2 \sin (4 (c+d x))+36 b^2 c+36 b^2 d x}{96 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.034, size = 89, normalized size = 0.9 \begin{align*}{\frac{1}{d} \left ({b}^{2} \left ({\frac{\sin \left ( dx+c \right ) }{4} \left ( \left ( \cos \left ( dx+c \right ) \right ) ^{3}+{\frac{3\,\cos \left ( dx+c \right ) }{2}} \right ) }+{\frac{3\,dx}{8}}+{\frac{3\,c}{8}} \right ) +{\frac{2\,ab \left ( 2+ \left ( \cos \left ( dx+c \right ) \right ) ^{2} \right ) \sin \left ( dx+c \right ) }{3}}+{a}^{2} \left ({\frac{\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2}}+{\frac{dx}{2}}+{\frac{c}{2}} \right ) \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 0.984981, size = 111, normalized size = 1.1 \begin{align*} \frac{24 \,{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - 64 \,{\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} a b + 3 \,{\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2}}{96 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.85724, size = 184, normalized size = 1.82 \begin{align*} \frac{3 \,{\left (4 \, a^{2} + 3 \, b^{2}\right )} d x +{\left (6 \, b^{2} \cos \left (d x + c\right )^{3} + 16 \, a b \cos \left (d x + c\right )^{2} + 32 \, a b + 3 \,{\left (4 \, a^{2} + 3 \, b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 1.24016, size = 211, normalized size = 2.09 \begin{align*} \begin{cases} \frac{a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac{a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac{a^{2} \sin{\left (c + d x \right )} \cos{\left (c + d x \right )}}{2 d} + \frac{4 a b \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac{2 a b \sin{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac{3 b^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac{3 b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac{3 b^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac{3 b^{2} \sin ^{3}{\left (c + d x \right )} \cos{\left (c + d x \right )}}{8 d} + \frac{5 b^{2} \sin{\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text{for}\: d \neq 0 \\x \left (a + b \cos{\left (c \right )}\right )^{2} \cos ^{2}{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.74242, size = 111, normalized size = 1.1 \begin{align*} \frac{1}{8} \,{\left (4 \, a^{2} + 3 \, b^{2}\right )} x + \frac{b^{2} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac{a b \sin \left (3 \, d x + 3 \, c\right )}{6 \, d} + \frac{3 \, a b \sin \left (d x + c\right )}{2 \, d} + \frac{{\left (a^{2} + b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]